-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[JEWEL-954] Implement ad text in popups #3358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[JEWEL-954] Implement ad text in popups #3358
Conversation
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PopupContainer.kt
Outdated
Show resolved
Hide resolved
b0a454a to
9ecf162
Compare
faogustavo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you are missing the LaF styles loading. Also, make sure to get values to match the theme.
For more details in the AdText styles, check the JBUI.CurrentTheme.Advertiser type. You can find its usage to use as baseline on this function public void setAdText(@NotNull @NlsContexts.PopupAdvertisement String s, int alignment)
4356525 to
c4d0b61
Compare
...el/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgePopupAdText.kt
Outdated
Show resolved
Hide resolved
...el/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgePopupAdText.kt
Outdated
Show resolved
Hide resolved
c4d0b61 to
91fba7f
Compare
ecf2915 to
20db336
Compare
faogustavo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to update API Dumps after updating public apis. Run the 'apiChecks' task in the IDE for it :)
...lone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiPopupAdTextStyling.kt
Outdated
Show resolved
Hide resolved
...i/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt
Outdated
Show resolved
Hide resolved
20db336 to
259bd6b
Compare
...i/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/ComboBox.kt
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/ListComboBox.kt
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PopupContainer.kt
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt
Outdated
Show resolved
Hide resolved
779db91 to
60a6e3f
Compare
faogustavo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PopupAdText.kt
Outdated
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/ComboBox.kt
Outdated
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PopupContainer.kt
Outdated
Show resolved
Hide resolved
60a6e3f to
932f1b6
Compare
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt
Outdated
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/PopupAdStyle.kt
Outdated
Show resolved
Hide resolved
932f1b6 to
2d55cab
Compare
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt
Show resolved
Hide resolved
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PopupAd.kt
Show resolved
Hide resolved
2d55cab to
5df0e71
Compare
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PopupContainer.kt
Show resolved
Hide resolved
5df0e71 to
1d5e506
Compare
1d5e506 to
68e45ea
Compare
platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt
Show resolved
Hide resolved
faogustavo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one minor comment. No blockers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about only using the 'JBUI.CurrentTheme.Advertiser.*' class methods instead of getting by key? This way we don't need to duplicate/copy the fallback logic. And if they change in the future we get that automatically
| ) { | ||
| content() | ||
|
|
||
| adContent?.let { PopupAd(modifier = Modifier.fillMaxWidth()) { it() } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is the only place we can use PopupAd, I'm wondering whether its style should simply be a property of the popup container's style? I.e., PopupContainerStyle should have an adStyle property added. Then we do not need to create a composition local for it, nor add an overload for the default component styling, nor add the JewelTheme extension. WDYT? Should simplify the PR even more
Summary
This PR introduces a new component called
PopupAd, which is designed to be used inside a popup container to give a more informative description to that menu. To use that, you can pass a composable to theadContentparameter introduced to theMenuandPopupContainerpublic API. This API is designed to be simpler as we have inAbstractPopup#setAdTextmethod in the legacy Swing implementation, but in a "composey" way.Additionally, a new
Menussection was introduced to the sample app to showcase menus, including a dedicated sample for menu with ad content.Release notes
PopupAdcomponentPopupAdStyleto theJewelThemeand to theIntUiThemeadContentparameter toPopupContainerandMenucomponents.New features
Note
Adds a styled ad area for popups and wires it through themes and APIs.
PopupAdcomponent and styling types:PopupAdStyle,PopupAdColors,PopupAdMetrics; exposesJewelTheme.popupAdStyleDefaultComponentStyling/ComponentStylingandIntUiThemeto includepopupAdStyle; adds Int UI defaults (IntUiPopupAdStyling.kt) and LaF bridge readerreadPopupAdStyle()PopupMenuandPopupContainerwith optionaladContentslot (keeps deprecated overloads); updates menu rendering to clip and appendPopupAdMenusshowcase (including ad-content example) and new menu iconsWritten by Cursor Bugbot for commit 68e45ea. This will update automatically on new commits. Configure here.